/*
 * Created on Oct 13, 2005 7:45:07 AM
 * 
 * $Id: UnixDirHandler.java,v 1.1 2005/10/16 14:14:57 olu Exp $
 *
 */
package tripleo.framework.fs;

import java.io.*;
import java.sql.Array;
import java.util.*;

import tripleo.util.Assert;

public class UnixDirHandler implements IDirHandler {

	private String basePath;

	public UnixDirHandler(String aBaseUrl) {
		basePath = aBaseUrl;
	}

	public FileDesc describe(String aS) {
		final FileDesc fileDesc = new UnixFileDesc(aS);
		return fileDesc;
	}

	public FileDesc open(String aS, String aType) {
		// TODO Auto-generated method stub
		Assert.not_implemented();
		return null;
	}

	public Iterator<FileDesc> enumAll() {
		String[] x = new File(basePath).list();
		ArrayList L = new ArrayList();
		if (x!=null) {
			for (String m : x) {
				L.add(new UnixFileDesc(m));
			}
		}
		return L.iterator();
	}

//	public void unlink(FileDesc aDesc) throws FileOpFailure {
//		final String path = ((UnixFileDesc)aDesc).getPath();
//		if (!new tripleo.fs.File(path).delete())
//			throw new FileOpFailure("java failed to delte directory");
//	}

}

